/*!
 * \file nuExecute.h
 * \brief Executing object.
 * \author Nus
 * \date 2008/02/17, 01:27
 */

#ifndef __NUEXECUTE_H__
#define __NUEXECUTE_H__

#include "Types.h"
#include "nuUpdateParam.h"
#include "nuDrawParam.h"

// Manager prototype.
class nuExecMgr;

/*!
 * \class nuExecute
 * \brief Execute class.
 * Use this class to execute your update procedure and draw procedure.
 * There are 2 update functions, asynchronous and synchronous update.
 * Asynchronous update will be executed in parallel, while the synchronous
 * one will be executed from main thread.
 * There is only 1 draw function available which will executed in parallel.
 * Use draw priority in order to sort your drawing.
 */
class nuExecute : public nuObject
{
  BEGIN_RTTI_DECL(nuExecute);
    RTTI_DECL(nuExecute, nuObject);
  END_RTTI_DECL(nuExecute);

private:
  friend class nuExecMgr;

public:
  //! \brief Default constructor.
  nuExecute(u32 priority = 0);

  //! \brief Default destructor.
  virtual ~nuExecute();
  
  //! \brief Asynchronous update.
  virtual void updateAsync(nuUpdateParam* param) = 0;

  //! \brief Update.
  virtual void update(nuUpdateParam* param) = 0;

  //! \brief Draw.
  virtual void draw(nuDrawParam* param) = 0;
  
  //! \brief Get priority.
  s32 getPriority(void) const {
    return mExecutePriority;
  }

protected:
  // None...

private:
  nuExecute* mpNext;              //!< Next object.
  nuExecute* mpPrev;              //!< Previous object.
  s32 mExecutePriority;           //!< Execute priority.

};

#endif
